package com.yndsoft.jc.ui.memberpage.login;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.yndsoft.jc.R;
import com.yndsoft.jc.activity.BaseActivity;
import com.yndsoft.jc.supplier.utils.ToastUtil;
import com.yndsoft.jc.utils.ConstantValues;

import butterknife.Bind;

/**
 * Created by hasee on 2017/12/14.
 */

public class ChooseRoleActivity extends BaseActivity {

    @Bind(R.id.base_backBtn)
    RelativeLayout base_backBtn;
    @Bind(R.id.base_title)
    TextView base_title;
    @Bind(R.id.choose_role_member)
    Button choose_role_member;
    @Bind(R.id.choose_role_supplier)
    Button choose_role_supplier;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_choose_role);
        init();
    }

    public void init() {
        base_title.setText(getResources().getString(R.string.choose_role));
        base_backBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        choose_role_member.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //ToastUtil.show(ChooseRoleActivity.this, "---会员登录---");
                Intent intent = null;
                intent = new Intent(ChooseRoleActivity.this, LoginActivity.class);
                intent.putExtra("role", "member");
                startActivityForResult(intent,ConstantValues.LOGIN_REQUEST);
                finish();
            }
        });
        choose_role_supplier.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //ToastUtil.show(ChooseRoleActivity.this, "---检测机构登录---");
                Intent intent = null;
                intent = new Intent(ChooseRoleActivity.this, LoginActivity.class);
                intent.putExtra("role", "supplier");
                startActivity(intent);
                finish();
            }
        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode==RESULT_OK){
            setResult(RESULT_OK);
            finish();
        }
    }
}
